package utils;

import org.springframework.stereotype.Component;

@Component
public class CommonRetumType {
    //表明对应请求的返回处理结果“success”或者"fail"
    private String status;
    //若stats=success,则data内返回前端json数据
    //若stats=fail,则data内使用的错误码格式
    private Object data;
    private String msg;


    //定义一个通用的创建方法

    public static CommonRetumType create(Object result,String msg)
    {
        return CommonRetumType.create(result,"success",msg);
    }

    public static CommonRetumType create(Object result,String status,String msg)
    {
       CommonRetumType type = new CommonRetumType();
       type.setStatus(status);
       type.setData(result);
       type.setMsg(msg);
       return type;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }
    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }


}
